/**
* author: SamWu
* email：samwulqy@gmail.com
**/
<?php
require_once 'config.php';

try {
    $dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME.";charset=".DB_CHARSET;
    $options = [
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
        PDO::ATTR_EMULATE_PREPARES => false,
    ];
    
    $pdo = new PDO($dsn, DB_USER, DB_PASS, $options);
    
    // 设置时区
    $pdo->exec("SET time_zone = '+00:00'");
    
} catch (PDOException $e) {
    error_log("Database connection failed: " . $e->getMessage());
    header('HTTP/1.1 503 Service Unavailable');
    die(json_encode(['error' => 'Service unavailable']));
}
?>
